
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //substring 截取字符串 
    //语法 字符串.substring(起始索引,[结束索引])
    let xh = '心海好想念你啊!!!'
    //例如 我想截取最后一个字符
    console.log(xh.substring(xh.length-1))  //  !
    //截取中间
    console.log(xh.substring(2,5)) // 好想念
    
  </script>
</body>
</html>